package com.java.architect.manager.context;

import com.java.architect.manager.aop.DataCache;
import com.java.architect.manager.aop.DataCacheEvict;
import com.java.architect.utils.CacheType;
import org.springframework.stereotype.Component;

/**
 * @author Java架构师之旅
 * @date 2022年05月28日 15:37
 */
@Component
public class ContextManager {

    @DataCache(group = "context",key = "('id=').concat(#id)",cacheNull = false,expire = 60 * 5)
    public String getContextInfo(long id){
        System.out.println("走数据库拿数据");

        return "getContextInfo&"+id;
    }

    @DataCacheEvict(group = "context",key = {
        "('id=').concat(#id)"},
        type = {CacheType.REDIS}
    )
    public void evict(long id){

    }
}
